﻿
var connection = require("../../app_modules/dbAccess/mongoConfig.js");
var mongoose = require('mongoose');
//var db = mongoose.connect(connection.getConnectionString("")); //连接test数据库
var db = mongoose.createConnection(connection.getConnectionString(""));

var Schema = mongoose.Schema; //创建模型【骨架模板】
var rollImageSchema = new Schema({
    title: String,
    description: String,
    takeDate: String,
    filename: String,
    createDate: Date,
    order: String,
});

rollImageSchema.methods.add = function (rollImage, callback) {
    this.title = rollImage.title;
    this.description = rollImage.description;
    this.takeDate = rollImage.takeDate;
    this.filename = rollImage.filename;
    this.createDate = rollImage.createDate;
    this.order = rollImage.order;
    this.save(callback);
}


var rollImage = db.model('rollImages', rollImageSchema);
module.exports = rollImage;
